// src/modules/user/dto/change-password.dto.ts
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, MinLength, Matches } from 'class-validator';

export class ChangePasswordDto {
  @ApiProperty({
    description: '当前密码',
    example: 'OldPassword123!',
  })
  @IsNotEmpty({ message: '当前密码不能为空' })
  @IsString()
  currentPassword: string;

  @ApiProperty({
    description: '新密码',
    example: 'NewPassword456!',
  })
  @IsNotEmpty({ message: '新密码不能为空' })
  @IsString()
  @MinLength(8, { message: '密码至少8位' })
  @Matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d@$!%*?&]{8,}$/, {
    message: '密码必须包含大小写字母和数字',
  })
  newPassword: string;

  @ApiProperty({
    description: '确认新密码',
    example: 'NewPassword456!',
  })
  @IsNotEmpty({ message: '确认密码不能为空' })
  @IsString()
  confirmPassword: string;
}
